lunomobs:register_mob("lunomobs:rat", {
	type = "animal",
	hp_max = 5,
	--xp_give = 1,
	collisionbox = {-0.2, -0.01, -0.2, 0.2, 0.2, 0.2},
	visual = "mesh",
	mesh = "mobs_rat.x",
	textures = {"mobs_rat.png"},
	makes_footstep_sound = false,--Se faz som ao andar
	walk_velocity = 1,--Velocidade ao andar
	armor = 200, --rato de armadura? (invencivel armor~=200. nao sei pq!!! )
	drops={ 
		{name="lunorecipes:cheese", chance=1, min=1, max=2,}, --Chance de 100% de dropar de 1 queijo
		{name="lunotrades:minecoin", chance=20, min=1, max=1,}, --Chance de 5% de dropar de 1 moeda
	},
	drawtype = "front",
	water_damage = 1,
	lava_damage = 10,
	light_damage = 0,
	shadow_damage = 1,
	disable_fall_damage = true, --Não leva dano quando cai do alto
	sounds = {
		random="pet_rat",
		die="pet_rat",
		hit="pet_rat",
	},
	view_range = 5,
	follow = "lunorecipes:cheese", --Tipos de comidas que atraem este animal
	foods = { --Tipos de comidas que domesticam este animal
		"lunorecipes:cheese", 
	},
	catch_tool = "", --Que tipo de item pode capturar este mob. ""==mãos | nil==NaoCaptura
	damage_thief = 7, --Dano em caso alguem tente interagir um pet domesticado que nao lhe pertece.
})

lunomobs:register_spawn("lunomobs:rat", {
	"default:dirt", "default:dirt_with_grass", "watershed:grass", 
	"default:grass_1", "default:grass_2", "default:grass_3", "default:grass_4", "default:grass_5", 
	"default:stone", "watershed:stone"
--}, 10, -1, 7000, 1, 31000)
}, 20, 8, 7000, 1, 31000)

minetest.register_craftitem("lunomobs:rat", {
	description = "Rato (Domestiado)",
	groups = { mobs=1 },
	inventory_image = "mob_rat_1.png",
	on_place = function(itemstack, placer, pointed_thing)
		if pointed_thing.above then
			local myRato = minetest.env:add_entity(pointed_thing.above, "lunomobs:rat")
			myRato:get_luaentity().tamed = true
			myRato:get_luaentity().textures = {"mobs_rat1.png"}
			myRato:get_luaentity().owner = placer:get_player_name()
			if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end
		end
		return itemstack
	end,
})

minetest.register_alias("rat"					, "lunomobs:rat")
minetest.register_alias("ratwild"			, "lunomobs:rat")
minetest.register_alias("rato"				, "lunomobs:rat")
minetest.register_alias("ratoselvagem"		, "lunomobs:rat")


if lunorecipes ~=nil and lunorecipes.doEat~=nil then
	minetest.register_craft({
		type = "cooking",
		output = "lunomobs:rat_cooked",
		recipe = "lunomobs:rat",
		cooktime = 5,
	})

	minetest.register_craftitem("lunomobs:rat_cooked", {
		description = "Rato Assado (SP+3)",
		inventory_image = "obj_rat_cooked.png",
		groups = { mobs=2 },
		on_use = function(itemstack, user, pointed_thing)
			return lunorecipes.doEat(user, itemstack, 0, 6, "obj_chew")
		end,
	})
	
	minetest.register_alias("ratcooked"			, "lunomobs:rat_cooked")
	minetest.register_alias("ratoassado"		, "lunomobs:rat_cooked")
end
